package com.cwits.wifi.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cwits.wifi.R;


/**
 * Created by ZhangHua on 16-03-01.
 */
public class ObdDialog extends Dialog {

    private TextView mTvClose;
    private RelativeLayout mRlObd, mRl168;

    public ObdDialog(Context context, View.OnClickListener itemsOnClick) {
        super(context, R.style.MyDialog);
        setContentView(R.layout.dialog_obd);

        this.setCanceledOnTouchOutside(false);
        this.setCancelable(false);

        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.CENTER;
        window.setAttributes(params);


        mTvClose = (TextView) findViewById(R.id.dialog_obd_tv_close);
        mRlObd = (RelativeLayout) findViewById(R.id.dialog_obd_rl_obd);
        mRl168 = (RelativeLayout) findViewById(R.id.dialog_obd_rl_168);


        mTvClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        mRlObd.setOnClickListener(itemsOnClick);
        mRl168.setOnClickListener(itemsOnClick);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @Override
    public void show() {
        if (this.isShowing())
            return;
        super.show();
    }
}
